This invention relates to a system for testing software codes and more specifically to an interactive software testing system that tests concurrent program codes that share common variables.
As computers are becoming an integral part of society, software codes for a variety of applications are being developed at an ever increasing pace. The life span of each version of a software program is decreasing as microprocessors and memory devices are becoming more powerful. Therefore, software developers are faced with generating new software code on a continuous basis.
As is evident to one who has ever written even a simple software code, the process of generating software and then testing it for any errors is detailed and time-consuming. In order to shorten the development cycle time of software code, many efforts have been made to develop reliable and convenient software testing systems for debugging software. Furthermore there has been efforts made to create software verification systems. Although software verification systems are more reliable than software testing systems, they require great amount of memory and system resources to operate. Thus, the preferred method to check the integrity of a software is to employ a software testing system.
Some of the prior art testing techniques are based on criteria for covering execution paths. For example, a variety of conditions are selected and a portion of a code is executed from a point A to some point B. Different coverage criteria are given as a heuristic measure for the quality of testing. One criterion, for example, is based on covering all the execution statements. Other criteria is based on covering all the logical tests, or all the flow of control from any setting of a variable to any of its possible uses. Thereafter, statistics are maintained on a global level relating to the effectiveness of different coverage approaches. Statistics are also maintained on a local level relating to the overall level of coverage achieved for the particular code tested.
Generally, the above-mentioned software testing systems are primarily based on software modeling techniques. These modeling techniques employ a complex array of algorithms, logics and proof systems. As a result, potential users are reluctant to learn new syntax, or perform the required modeling process.
One approach to avoid the need for modeling systems starts at the notation side. It provides design tools that are based on simple notations such as graphs, automata theory, as described in B. Selic, G. Gullekson, P.T. Ward, Real Time Object-Oriented Modeling (Wiley, 1993), or message sequence charts as described in R. Alur, G. Holzmann, D. Peled, Message Sequence Charts, Software: Concepts and Tools, 17 pp.70-77 (1996) or as described in U.S. Pat. No. 5,812,145. The system is then refined, starting with some simplistic basic design. Such tools usually provide several gadgets that allow the system designer to perform various automatic or human assisted checks. There is some support for checking or guaranteeing the correctness of some steps in the refinement of systems. Some design tools even support automatic code generation. This approach prevents the need for modeling by starting the design with some abstract model, and refining it into a full system. However, this approach is not efficient or simple. Furthermore, the above-mentioned software testing systems are not appropriate for concurrent programs that share one or more variables.
Thus, there is a need for an efficient and convenient software testing system that is applicable to both sequential and concurrent software programs.
A method for visualizing and testing a sequence of a software code that includes instructions relating to assignment of variables, and decision branches is provided. The method comprises the steps of generating a plurality of nodes, edges and text indications that correspond to the instructions in the software code. A plurality of pointers are then generated to associate the location of at least one line of the software code to at least one of the generated nodes. The pointers may also associate the location of a line in the software code to at least one of the generated edges. The method then displays a flow chart representing the generated nodes, and edges and text indications, so that the software code can be visualized. When a user selects a node or an edge in the displayed flow chart, a corresponding portion of the software code is also identified.
In accordance with another embodiment of the invention, a portion of the software code defining an execution path is selected. The system then calculates the logically most general condition for the possible execution of the selected path.
In accordance with yet another embodiment of the invention, the path may be selected by a user who highlights the nodes and/or edges along the displayed flow chart to calculate the conditions that allow the execution of the selected path. In an alternative arrangement, various paths may be selected by the system and the results of condition calculations are then presented to the user.
In accordance with yet another embodiment of the invention, the visualization and testing system described above is also applied to a collection of one or more codes for concurrent processes. As a result, the system provides a collection of graphical representations of the flow charts of the processes, so as to allow the user to select an interleaved path through the concurrent processes. Once such a path has been selected, the system calculates the logically most general condition for the possible execution of the path, and provides the calculation results as an output.
The software testing system in accordance with one embodiment of the invention allows the user to define a new path by inputting modifications to a previously selected path.